Skip to content

fix(dashboard): resolve module resolution and build failures - #351

Merged
Lakes41 merged 1 commit into
Adamantine-guild:mainfrom
TheBigWealth89:fix/dashboard-module-resolution
Aug 20, 2026
Merged

fix(dashboard): resolve module resolution and build failures#351
Lakes41 merged 1 commit into
Adamantine-guild:mainfrom
TheBigWealth89:fix/dashboard-module-resolution

Conversation

@TheBigWealth89

Copy link
Copy Markdown
Contributor

Description

This PR fixes the Module not found build errors in apps/dashboard when importing internal monorepo packages (like @guildpass/env). It resolves incorrect TypeScript path alias mappings that were causing Next.js to attempt to bundle .d.ts declaration files as runtime code, and updates the transpile settings to ensure all workspace packages are built correctly by the bundler.

Linked Issue

Closes #341

Type of Change

  • 🐛 Bug fix
  • ✨ New feature / enhancement
  • 📝 Documentation update
  • 🔧 Chore / refactor
  • 🧪 Tests only

Changes Made

  • apps/dashboard/tsconfig.json: Replaced explicit path aliases targeting .d.ts files with a dynamic @guildpass/* alias mapped to ../../packages/*. This allows Node module resolution to properly link to the package.json main/types fields and fixes the Next.js Webpack bundler crashes.
  • apps/dashboard/next.config.mjs: Added @guildpass/metrics to transpilePackages to ensure the dashboard properly transpiles the workspace package containing raw TypeScript source code.
  • apps/dashboard/README.md: Added a Setup & Build Process section to document the required build order, the purpose of the path aliases, and environment variable requirements for durable storage.

Test Evidence

The production build and static page generation now complete cleanly without Module not found errors:

$ pnpm --filter @guildpass/dashboard build
...
 ✓ Compiled successfully
   Linting and checking validity of types ...
 ⚠ TypeScript project references are not fully supported. Attempting to build in incremental mode.
   Collecting page data ...
   Generating static pages (0/27) ...
   Generating static pages (6/27) 
   Generating static pages (13/27) 
   Generating static pages (20/27) 
 ✓ Generating static pages (27/27)
   Finalizing page optimization ...
   Collecting build traces ...

Additionally, pnpm typecheck successfully passes without raising module resolution failures.

Checklist

  • I have read CONTRIBUTING.md
  • This PR is linked to an open issue
  • pnpm typecheck passes with no errors
  • pnpm lint passes (or issues are pre-existing and documented)
  • pnpm test passes (all existing tests still pass)
  • The dashboard starts and renders correctly (if UI or API code changed)
  • The Discord bot still starts and responds to commands (if bot code changed)
  • Docs site renders correctly (if docs changed): pnpm dev:docs
  • No secrets, tokens, or API keys are included in this PR
  • Environment variable changes are reflected in .env.example
  • I have updated documentation if new behaviour was introduced

Screenshots / Recordings

N/A - Infrastructure and build pipeline fixes.

Additional Notes

  • The resolution heavily leans on the default Node module resolution through workspace symlinks instead of hard-mapping .d.ts paths, ensuring robust compatibility with Next.js' App Router compilation in the monorepo context.

Configure tsconfig path aliases for monorepo workspace packages. Update next.config.mjs transpilePackages to include metrics. Document build process and aliases setup.
@Lakes41
Lakes41 merged commit 5da13c0 into Adamantine-guild:main Aug 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract and validate Next.js build configuration in apps/dashboard

2 participants